{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb6}
		</small>
	</h1>
</div>
<div class="page-header">
	<a href="{:url('Contract/issue_add')}" class="btn btn-primary">新增</a>
</div>
<form action="{:url('Contract/issue_config')}" method="get">
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>
				<select name="exchange_id" style="width: 200px;"  id ="exchange_id">
					<option value ="">--   交易所   --</option>
					{volist name="exchange" id="ex" empty="$exchange"}
					<option value="{$ex.id}" {if condition="input('param.exchange_id') eq $ex.id"} selected {/if} >{$ex.name}</option>
					{/volist}
				</select>
				<select name="variety_id" id="variety_id">
					<option value="">--   交易品种   --</option>
				</select>
				&nbsp;&nbsp;&nbsp;
				<button class="btn btn-primary">查询</button>&nbsp;&nbsp;&nbsp;
				<a href="{:url('Contract/issue_config')}" class="btn btn-primary">清空查询条件</a>
			</th>
		</tr>
		</thead>
	</table>
</form>
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>id</th>
						<th>交易所</th>
						<th>交易品种</th>
						<th>发行价</th>
						<th>目标价</th>
						<th>备注</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>						
							<td>{$v.id}</td>
							<td>{$v.exchange}</td>
							<td>{$v.variety}</td>
							<td>{$v.issue}</td>
							<td>{$v.target}</td>
							<td>{$v.remark}</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:url("Contract/issue_update",array("id"=>$v["id"]))}'>
									<i class="fa fa-edit bigger-120"></i>
								</a>
								<a class="delete btn btn-xs btn-danger" href='{:url("Contract/del",array("model"=>"contract_issue","id"=>$v["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
				</tbody>
			</table>
		</div>
		{$page}
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	

      $("#search1").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        //alert(url);
        window.location.href = url;
    });	
});
</script>
<script type="text/javascript">
	$('#exchange_id').change(function(){
		//alert("abc");
		var iframe_array = <?php echo  json_encode($variety);   ?>;
		var checkValue=jQuery("#exchange_id").val();
		//alert(checkValue);
		$("#variety_id").empty();
		for (var i = 0; i <iframe_array.length ; i++)
		{
			if(iframe_array[i]['exchange_id']==checkValue)
			{
				var opt = "<option value='"+iframe_array[i]['id']+"'>"+iframe_array[i]['name']+"</option>";
				jQuery("#variety_id").append(opt);
			}
		}

	})
</script>
{/block}